#!/bin/bash

NAMESPACE="architecture-station"

echo "Stopping all resources in namespace: $NAMESPACE"

# Scale down Deployments
kubectl scale deployment --all --replicas=0 -n $NAMESPACE

# Scale down StatefulSets
kubectl scale statefulset --all --replicas=0 -n $NAMESPACE

# Delete ingress
kubectl delete ingress --all -n $NAMESPACE
kubectl delete ingressclass nginx

# Delete all Pods
kubectl delete pod --all -n $NAMESPACE

# Stop Redis and MySQL using Helm
helm uninstall $NAMESPACE-mysql -n $NAMESPACE
helm uninstall $NAMESPACE-redis -n $NAMESPACE
helm uninstall nginx-ingress --namespace $NAMESPACE

echo "All resources stopped in namespace: $NAMESPACE"
